Other Functions
The following functions are available globally.
-
Equal equatable
Declaration
Swift
public func == (lhs: SignUpError, rhs: SignUpError) -> Bool
-
Creates a
DataRequest
using the defaultSessionManager
to retrieve the contents of the specifiedurl
,method
,parameters
,encoding
andheaders
.Declaration
Swift
public func request( _ url: URLConvertible, method: HTTPMethod = .get, parameters: Parameters? = nil, encoding: ParameterEncoding = URLEncoding.default, headers: HTTPHeaders? = nil) -> DataRequest
-
Creates a
DataRequest
using the defaultSessionManager
to retrieve the contents of a URL based on the specifiedurlRequest
.Declaration
Swift
public func request(_ urlRequest: URLRequestConvertible) -> DataRequest
-
Creates a
DownloadRequest
using the defaultSessionManager
to retrieve the contents of the specifiedurl
,method
,parameters
,encoding
,headers
and save them to thedestination
.If
destination
is not specified, the contents will remain in the temporary location determined by the underlying URL session.Declaration
Swift
public func download( _ url: URLConvertible, method: HTTPMethod = .get, parameters: Parameters? = nil, encoding: ParameterEncoding = URLEncoding.default, headers: HTTPHeaders? = nil, to destination: DownloadRequest.DownloadFileDestination? = nil) -> DownloadRequest
-
Creates a
DownloadRequest
using the defaultSessionManager
to retrieve the contents of a URL based on the specifiedurlRequest
and save them to thedestination
.If
destination
is not specified, the contents will remain in the temporary location determined by the underlying URL session.Declaration
Swift
public func download( _ urlRequest: URLRequestConvertible, to destination: DownloadRequest.DownloadFileDestination? = nil) -> DownloadRequest
-
Creates a
DownloadRequest
using the defaultSessionManager
from theresumeData
produced from a previous request cancellation to retrieve the contents of the original request and save them to thedestination
.If
destination
is not specified, the contents will remain in the temporary location determined by the underlying URL session.Declaration
Swift
public func download( resumingWith resumeData: Data, to destination: DownloadRequest.DownloadFileDestination? = nil) -> DownloadRequest
-
Creates an
UploadRequest
using the defaultSessionManager
from the specifiedurl
,method
andheaders
for uploading thefile
.Declaration
Swift
public func upload( _ fileURL: URL, to url: URLConvertible, method: HTTPMethod = .post, headers: HTTPHeaders? = nil) -> UploadRequest
-
Creates a
UploadRequest
using the defaultSessionManager
from the specifiedurlRequest
for uploading thefile
.Declaration
Swift
public func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest
-
Creates an
UploadRequest
using the defaultSessionManager
from the specifiedurl
,method
andheaders
for uploading thedata
.Declaration
Swift
public func upload( _ data: Data, to url: URLConvertible, method: HTTPMethod = .post, headers: HTTPHeaders? = nil) -> UploadRequest
-
Creates an
UploadRequest
using the defaultSessionManager
from the specifiedurlRequest
for uploading thedata
.Declaration
Swift
public func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest
-
Creates an
UploadRequest
using the defaultSessionManager
from the specifiedurl
,method
andheaders
for uploading thestream
.Declaration
Swift
public func upload( _ stream: InputStream, to url: URLConvertible, method: HTTPMethod = .post, headers: HTTPHeaders? = nil) -> UploadRequest
-
Creates an
UploadRequest
using the defaultSessionManager
from the specifiedurlRequest
for uploading thestream
.Declaration
Swift
public func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest
-
Encodes
multipartFormData
usingencodingMemoryThreshold
with the defaultSessionManager
and callsencodingCompletion
with newUploadRequest
using theurl
,method
andheaders
.It is important to understand the memory implications of uploading
MultipartFormData
. If the cummulative payload is small, encoding the data in-memory and directly uploading to a server is the by far the most efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be used for larger payloads such as video content.The
encodingMemoryThreshold
parameter allows Alamofire to automatically determine whether to encode in-memory or stream from disk. If the content length of theMultipartFormData
is below theencodingMemoryThreshold
, encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding technique was used.Declaration
Swift
public func upload( multipartFormData: @escaping (MultipartFormData) -> Void, usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, to url: URLConvertible, method: HTTPMethod = .post, headers: HTTPHeaders? = nil, encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?)
-
Encodes
multipartFormData
usingencodingMemoryThreshold
and the defaultSessionManager
and callsencodingCompletion
with newUploadRequest
using theurlRequest
.It is important to understand the memory implications of uploading
MultipartFormData
. If the cummulative payload is small, encoding the data in-memory and directly uploading to a server is the by far the most efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be used for larger payloads such as video content.The
encodingMemoryThreshold
parameter allows Alamofire to automatically determine whether to encode in-memory or stream from disk. If the content length of theMultipartFormData
is below theencodingMemoryThreshold
, encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding technique was used.Declaration
Swift
public func upload( multipartFormData: @escaping (MultipartFormData) -> Void, usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, with urlRequest: URLRequestConvertible, encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?)
-
Returns whether the two network reachability status values are equal.
Declaration
Swift
public func ==( lhs: NetworkReachabilityManager.NetworkReachabilityStatus, rhs: NetworkReachabilityManager.NetworkReachabilityStatus) -> Bool
-
Equal equatable
Declaration
Swift
public func == (lhs: LoginError, rhs: LoginError) -> Bool